## -*- mode: html; coding: utf-8; -*-

## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## CDS Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDS Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

<!-- WebDoc-Page-Title: Create knowledgebase files (bibrankgkb) -->
<!-- WebDoc-Page-Navtrail: <a class="navtrail" href="<CFG_SITE_URL>/help/hacking">Hacking CDS Invenio</a> &gt; <a class="navtrail" href="bibrank-internals">BibRank Internals</a> -->
<!-- WebDoc-Page-Revision: $Id$ -->

<pre>
<blockquotes>
   1. Read default configuration file or the one specified by the user

   2. Read each create_ line from the cfg file, for each line, read the
      source(s) from either database, file or www by calling get_from_source().
      Convert between naming conventions if source for convertion data is given.

   3. Merge into one file, repeat 2. until last source is read.

   4. Save file if requested with --output

   Configuration:

   How to spesify a source:
       -create_x = filter, source
   Where x is a number from 0 and up. The source and the filter is read,
   and each line in the source is checked against the filter to be converted
   into the correct naming standard. If no filter is given, the source is
   directly translated into a .kb file.

   Read filter from:

   File:
     [bibrankgkb]
     <protect>#give path to file containing lines like: COLLOID SURFACE A---Colloids Surf., A</protect>
     kb_1_filter = <ETCDIR>/bibrank/bibrankgkb_jif_conv.kb
     <protect>#replace filter with the line below (switch kb_1_filter with the variable names you used)</protect>
     create_0 = file,,%(kb_1_filter)s

   Read source from:

   Database:
     [bibrankgkb]
     <protect>#Specify sql statements
     kb_2 = SELECT id_bibrec,value FROM bib93x,bibrec_bib93x WHERE tag='938__f' AND id_bibxxx=id
     kb_3 = SELECT id_bibrec,value FROM bib21x,bibrec_bib21x WHERE tag='210__a' AND id_bibxxx=id
     <protect>#replace source with the line below (switch kb_2 and kb_3 with the variable names you used)</protect>
     db,,%(kb_2)s,,%(kb_3)s

   File:
     [bibrankgkb]
     <protect>#give path to file containing lines like: COLLOID SURFACE A---1.98</protect>
     kb_1 = <ETCDIR>/bibrank/bibrankgkb_jif_example.kb
     <protect>#replace source with the line below (switch kb_1 with the variable names you used)</protect>
     create_0 = file,,%(kb_1)s

   Internet:
     [bibrankgkb]
    <protect> #specify the urls to the file containing JIF data</protect>
     url_0 = http://www.sciencegateway.org/impact/if03a.htm
     url_1 = http://www.sciencegateway.org/impact/if03bc.htm
     url_2 = http://www.sciencegateway.org/impact/if03df.htm
     url_3 = http://www.sciencegateway.org/impact/if03gi.htm
     url_4 = http://www.sciencegateway.org/impact/if03j.htm
     url_5 = http://www.sciencegateway.org/impact/if03ko.htm
     url_6 = http://www.sciencegateway.org/impact/if03pr.htm
     url_7 = http://www.sciencegateway.org/impact/if03sz.htm
     <protect>#give the regular expression necessary to extract the key and value from the file</protect>

     url_regexp = (TR bgColor=\#ffffff>\s*?\n\s*?<TD>(?P<key>.*?)</TD>\s*?\n\s*?<TD>.*?</TD>\s*?\n\s*?<TD .*?>.*?</TD>\s*?\n\s*?<TD .*?><A.*?\n.*?</TD>\s*?\n\s*?<TD.*?>(?P<value>[\w|,]+)</TD></TR>)

     <protect>#replace source with the line below (switch kb_4 and url_regexp with the variable names you used)</protect>
     create_0 = www,,%(kb_4)s,,%(url_regexp)s

</pre>
</blockquotes>
